# @Time : 2024/3/2 15:17
# @Author  : baby_
# @Desc : ==============================================
# Life is Short I Use Python!!!                      ===
# ======================================================
# @Project : Reminder
# @FileName: 0003_init_classify_base_data
# @Software: PyCharm
from django.db import migrations
from prompt.models import Classify, Prompt


def init_classify_base_data(apps, schema_editor):
    classify = [
        {
            'classify': '健康提醒',
            'prompt': [
                '久坐', '喝水', '吃药',
            ],
        },
        {
            'classify': '学习提醒',
            'prompt': [
                '倒计时', '每日学习打卡',
            ],
        },
        {
            'classify': '工作提醒',
            'prompt': [
                '番茄工作', 'Deadline', '重要事件', '节日', '整点提醒'
            ],
        },
        {
            'classify': '生活提醒',
            'prompt': [
                '生日', '纪念日', '节日', '运动', '睡觉', '时间胶囊', '每日问候', '小笑话', '励志名言'
            ]
        },
        {
            'classify': '证券提醒',
            'prompt': [
                '外汇', '股票', '基金'
            ]
        },
    ]
    for item in classify:
        classify_obj = Classify.objects.create(name=item['classify'])
        for prompt in item['prompt']:
            Classify.objects.create(name=prompt, parent=classify_obj)


class Migration(migrations.Migration):
    dependencies = [
        ('prompt', '0003_classify_parent_task_condition_task_in_advance_and_more'),
    ]

    operations = [
        migrations.RunPython(init_classify_base_data)
    ]
